package com.lee.boot.head.first.demo.config;


import com.lee.boot.head.first.demo.servlet.HelloServlet;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Auther: Lee
 * @Date: 2018/6/27 17:02
 * @Description: 自动扫描servlet注解, 使用自动扫描需要指定包, 使用ServletComponentScan 指定servlet所在的包
 * servlet需添加WebServlet注解，表示自己是一个servlet
 */

@Configuration
@ServletComponentScan(basePackages = "com.lee.springboot.web.servlet")
@Deprecated
public class ServletConfig {
    /**
     * 下面这种是手动注册使用servlet的方式
     */
    @Bean
    public ServletRegistrationBean registerServlet() {
        return new ServletRegistrationBean(new HelloServlet(), "/servletUrlMapping");
    }

}
